package com.ethink.platform.controller.warehouse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.ethink.framework.common.web.BaseController;
import com.ethink.framework.common.web.response.CommonResponse;
import com.ethink.warehouse.api.MateInventoryLockLogFacade;
import com.ethink.warehouse.api.info.MateInventoryLockLogInfo;
import com.ethink.warehouse.api.request.MateInventoryLockLogAddRequest;
import com.ethink.warehouse.api.request.MateInventoryLockLogQueryRequest;
import com.ethink.warehouse.api.request.MateInventoryLockLogUpdateRequest;

/**
 * 库存锁定日志表 Controller
 *
 * @author default
 * @date 2022-12-12
 */
@Tag(name = "MateInventoryLockLogController", description = "库存锁定日志表 Controller")
@RestController
@Slf4j
@RequestMapping("platform-server/v1/warehouse-service")
public class MateInventoryLockLogController extends BaseController {

    @Autowired
    private MateInventoryLockLogFacade mateInventoryLockLogFacade;

    @Operation(summary = "分页查询")
    @GetMapping("/mateInventoryLockLog/query")
    public CommonResponse<List<MateInventoryLockLogInfo>> queryMateInventoryLockLog(MateInventoryLockLogQueryRequest request) {
        return succeedWithPage(mateInventoryLockLogFacade.queryMateInventoryLockLog(request));
    }

    @Operation(summary = "详情查询")
    @GetMapping("/mateInventoryLockLog/get/{mateInventoryLockLogId}")
    public CommonResponse<MateInventoryLockLogInfo> getMateInventoryLockLogById(@PathVariable("mateInventoryLockLogId") Long mateInventoryLockLogId) {
        return succeedWith(mateInventoryLockLogFacade.getMateInventoryLockLogById(mateInventoryLockLogId));
    }

    @Operation(summary = "查询所有")
    @GetMapping("/mateInventoryLockLog/list")
    public CommonResponse<List<MateInventoryLockLogInfo>> listMateInventoryLockLog(MateInventoryLockLogQueryRequest request) {
        return succeedWith(mateInventoryLockLogFacade.listMateInventoryLockLog(request));
    }

    @Operation(summary = "新增")
    @PostMapping("/mateInventoryLockLog/add")
    public CommonResponse addMateInventoryLockLog(@RequestBody MateInventoryLockLogAddRequest request) {
        mateInventoryLockLogFacade.addMateInventoryLockLog(request);
        return succeed();
    }

    @Operation(summary = "更新")
    @PutMapping("/mateInventoryLockLog/update")
    public CommonResponse updateMateInventoryLockLog(@RequestBody MateInventoryLockLogUpdateRequest request) {
        mateInventoryLockLogFacade.updateMateInventoryLockLog(request);
        return succeed();
    }

    @Operation(summary = "删除")
    @PutMapping("/mateInventoryLockLog/delete/{mateInventoryLockLogId}")
    public CommonResponse deleteMateInventoryLockLog(@PathVariable("mateInventoryLockLogId") Long mateInventoryLockLogId) {
        mateInventoryLockLogFacade.deleteMateInventoryLockLog(mateInventoryLockLogId);
        return succeed();
    }

}